}
TextLineComponent nextComponent =
- factory.createExtended(font, cm, decorator, startPos, startPos + lmCount);
+ factory.createTextLabel(font, cm, decorator, startPos, startPos + lmCount);
++numComponents;
if (numComponents > components.length) {
/**
* This class handles underlining, strikethrough, and foreground and
* background styles on text. Clients simply acquire instances
- * of this class and hand them off to ExtendedTextLabels or GraphicComponents.
+ * of this class and hand them off to ExtendedTextSourceLabels or
+ * GraphicComponents.
*/
public class Decoration {
+++ /dev/null
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- * (C) Copyright IBM Corp. 1998-2003- All Rights Reserved.
- */
-
-package sun.font;
-
-import java.awt.Font;
-
-import java.awt.font.GlyphJustificationInfo;
-import java.awt.font.LineMetrics;
-
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * An extension of TextLabel that maintains information
- * about characters.
- */
-
-public abstract class ExtendedTextLabel extends TextLabel
- implements TextLineComponent{
- /**
- * Return the number of characters represented by this label.
- */
- public abstract int getNumCharacters();
-
- /**
- * Return the line metrics for all text in this label.
- */
- public abstract CoreMetrics getCoreMetrics();
-
- /**
- * Return the x location of the character at the given logical index.
- */
- public abstract float getCharX(int logicalIndex);
-
- /**
- * Return the y location of the character at the given logical index.
- */
- public abstract float getCharY(int logicalIndex);
-
- /**
- * Return the advance of the character at the given logical index.
- */
- public abstract float getCharAdvance(int logicalIndex);
-
- /**
- * Return the visual bounds of the character at the given logical index.
- * This bounds encloses all the pixels of the character when the label is rendered
- * at x, y.
- */
- public abstract Rectangle2D getCharVisualBounds(int logicalIndex, float x, float y);
-
- /**
- * Return the visual index of the character at the given logical index.
- */
- public abstract int logicalToVisual(int logicalIndex);
-
- /**
- * Return the logical index of the character at the given visual index.
- */
- public abstract int visualToLogical(int visualIndex);
-
- /**
- * Return the logical index of the character, starting with the character at
- * logicalStart, whose accumulated advance exceeds width. If the advances of
- * all characters do not exceed width, return getNumCharacters. If width is
- * less than zero, return logicalStart - 1.
- */
- public abstract int getLineBreakIndex(int logicalStart, float width);
-
- /**
- * Return the accumulated advances of all characters between logicalStart and
- * logicalLimit.
- */
- public abstract float getAdvanceBetween(int logicalStart, int logicalLimit);
-
- /**
- * Return whether a caret can exist on the leading edge of the
- * character at offset. If the character is part of a ligature
- * (for example) a caret may not be appropriate at offset.
- */
- public abstract boolean caretAtOffsetIsValid(int offset);
-
- /**
- * A convenience overload of getCharVisualBounds that defaults the label origin
- * to 0, 0.
- */
- public Rectangle2D getCharVisualBounds(int logicalIndex) {
- return getCharVisualBounds(logicalIndex, 0, 0);
- }
-
- public abstract TextLineComponent getSubset(int start, int limit, int dir);
-
- /**
- * Return the number of justification records this uses.
- */
- public abstract int getNumJustificationInfos();
-
- /**
- * Return GlyphJustificationInfo objects for the characters between
- * charStart and charLimit, starting at offset infoStart. Infos
- * will be in visual order. All positions between infoStart and
- * getNumJustificationInfos will be set. If a position corresponds
- * to a character outside the provided range, it is set to null.
- */
- public abstract void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit);
-
- /**
- * Apply deltas to the data in this component, starting at offset
- * deltaStart, and return the new component. There are two floats
- * for each justification info, for a total of 2 * getNumJustificationInfos.
- * The first delta is the left adjustment, the second is the right
- * adjustment.
- * <p>
- * If flags[0] is true on entry, rejustification is allowed. If
- * the new component requires rejustification (ligatures were
- * formed or split), flags[0] will be set on exit.
- */
- public abstract TextLineComponent applyJustificationDeltas(float[] deltas, int deltaStart, boolean[] flags);
-}
import java.util.Map;
-/**
- * Default implementation of ExtendedTextLabel.
- */
-
// {jbr} I made this class package-private to keep the
// Decoration.Label API package-private.
-/* public */
-class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.Label {
+/**
+ * A label.
+ * Visual bounds is a rect that encompasses the entire rendered area.
+ * Logical bounds is a rect that defines how to position this next
+ * to other objects.
+ * Align bounds is a rect that defines how to align this to margins.
+ * it generally allows some overhang that logical bounds would prevent.
+ */
+class ExtendedTextSourceLabel implements TextLineComponent, Decoration.Label {
- TextSource source;
- private Decoration decorator;
+ private final TextSource source;
+ private final Decoration decorator;
// caches
private Font font;
private AffineTransform baseTX;
private CoreMetrics cm;
- Rectangle2D lb;
- Rectangle2D ab;
- Rectangle2D vb;
- Rectangle2D ib;
- StandardGlyphVector gv;
- float[] charinfo;
+ private Rectangle2D lb;
+ private Rectangle2D ab;
+ private Rectangle2D vb;
+ private Rectangle2D ib;
+ private StandardGlyphVector gv;
+ private float[] charinfo;
- float advTracking;
+ private float advTracking;
/**
* Create from a TextSource.
advTracking = font.getSize() * AttributeValues.getTracking(atts);
}
-
- // TextLabel API
-
- public Rectangle2D getLogicalBounds() {
- return getLogicalBounds(0, 0);
- }
-
+ /**
+ * Return a rectangle that corresponds to the logical bounds of the text
+ * when this label is rendered at x, y.
+ * This rectangle is used when positioning text next to other text.
+ */
public Rectangle2D getLogicalBounds(float x, float y) {
if (lb == null) {
lb = createLogicalBounds();
(float)lb.getHeight());
}
- public float getAdvance() {
- if (lb == null) {
- lb = createLogicalBounds();
- }
- return (float)lb.getWidth();
+ public float getAdvance() {
+ if (lb == null) {
+ lb = createLogicalBounds();
}
+ return (float)lb.getWidth();
+ }
+ /**
+ * Return a rectangle that surrounds the text outline when this label is rendered at x, y.
+ */
public Rectangle2D getVisualBounds(float x, float y) {
if (vb == null) {
vb = decorator.getVisualBounds(this);
(float)vb.getHeight());
}
+ /**
+ * Return a rectangle that corresponds to the alignment bounds of the text
+ * when this label is rendered at x, y. This rectangle is used when positioning text next
+ * to a margin. It differs from the logical bounds in that it does not include leading or
+ * trailing whitespace.
+ */
public Rectangle2D getAlignBounds(float x, float y) {
if (ab == null) {
ab = createAlignBounds();
}
+ /**
+ * Return a rectangle that corresponds to the logical bounds of the text, adjusted
+ * to angle the leading and trailing edges by the italic angle.
+ */
public Rectangle2D getItalicBounds(float x, float y) {
if (ib == null) {
ib = createItalicBounds();
return getGV().getOutline(x, y);
}
+ /**
+ * Return an outline of the characters in the label when rendered at x, y.
+ */
public Shape getOutline(float x, float y) {
return decorator.getOutline(this, x, y);
}
g.drawGlyphVector(getGV(), x, y);
}
+ /**
+ * Render the label at x, y in the graphics.
+ */
public void draw(Graphics2D g, float x, float y) {
decorator.drawTextAndDecorations(this, g, x, y);
}
+ /**
+ * A convenience method that returns the visual bounds when rendered at 0, 0.
+ */
+ public Rectangle2D getVisualBounds() {
+ return getVisualBounds(0f, 0f);
+ }
+
+ /**
+ * A convenience method that returns the logical bounds when rendered at 0, 0.
+ */
+ public Rectangle2D getLogicalBounds() {
+ return getLogicalBounds(0f, 0f);
+ }
+
+ /**
+ * A convenience method that returns the align bounds when rendered at 0, 0.
+ */
+ public Rectangle2D getAlignBounds() {
+ return getAlignBounds(0f, 0f);
+ }
+
+ /**
+ * A convenience method that returns the italic bounds when rendered at 0, 0.
+ */
+ public Rectangle2D getItalicBounds() {
+ return getItalicBounds(0f, 0f);
+ }
+
+ /**
+ * A convenience method that returns the outline when rendered at 0, 0.
+ */
+ public Shape getOutline() {
+ return getOutline(0f, 0f);
+ }
+
+ /**
+ * A convenience method that renders the label at 0, 0.
+ */
+ public void draw(Graphics2D g) {
+ draw(g, 0f, 0f);
+ }
+
+ /**
+ * A convenience overload of getCharVisualBounds that defaults the label origin
+ * to 0, 0.
+ */
+ public Rectangle2D getCharVisualBounds(int logicalIndex) {
+ return getCharVisualBounds(logicalIndex, 0, 0);
+ }
+
/**
* The logical bounds extends from the origin of the glyphvector to the
* position at which a following glyphvector's origin should be placed.
return gv;
}
- // ExtendedTextLabel API
-
private static final int posx = 0,
posy = 1,
advx = 2,
vish = 7;
private static final int numvals = 8;
+ /**
+ * Return the number of characters represented by this label.
+ */
public int getNumCharacters() {
return source.getLength();
}
+ /**
+ * Return the line metrics for all text in this label.
+ */
public CoreMetrics getCoreMetrics() {
return cm;
}
+ /**
+ * Return the x location of the character at the given logical index.
+ */
public float getCharX(int index) {
validate(index);
float[] charinfo = getCharinfo();
}
}
+ /**
+ * Return the y location of the character at the given logical index.
+ */
public float getCharY(int index) {
validate(index);
float[] charinfo = getCharinfo();
}
}
+ /**
+ * Return the advance of the character at the given logical index.
+ */
public float getCharAdvance(int index) {
validate(index);
float[] charinfo = getCharinfo();
charinfo[index + vish]);
}
+ /**
+ * Return the visual bounds of the character at the given logical index.
+ * This bounds encloses all the pixels of the character when the label is rendered
+ * at x, y.
+ */
public Rectangle2D getCharVisualBounds(int index, float x, float y) {
Rectangle2D bounds = decorator.getCharVisualBounds(this, index);
}
*/
+ /**
+ * Return the visual index of the character at the given logical index.
+ */
public int logicalToVisual(int logicalIndex) {
validate(logicalIndex);
return l2v(logicalIndex);
}
+ /**
+ * Return the logical index of the character at the given visual index.
+ */
public int visualToLogical(int visualIndex) {
validate(visualIndex);
return v2l(visualIndex);
}
+ /**
+ * Return the logical index of the character, starting with the character at
+ * logicalStart, whose accumulated advance exceeds width. If the advances of
+ * all characters do not exceed width, return getNumCharacters. If width is
+ * less than zero, return logicalStart - 1.
+ */
public int getLineBreakIndex(int start, float width) {
final float epsilon = 0.005f;
return start;
}
+ /**
+ * Return the accumulated advances of all characters between logicalStart and
+ * logicalLimit.
+ */
public float getAdvanceBetween(int start, int limit) {
float a = 0f;
return a;
}
+ /**
+ * Return whether a caret can exist on the leading edge of the
+ * character at offset. If the character is part of a ligature
+ * (for example) a caret may not be appropriate at offset.
+ */
public boolean caretAtOffsetIsValid(int offset) {
// REMIND: improve this implementation
return sb.toString();
}
- //public static ExtendedTextLabel create(TextSource source) {
- // return new ExtendedTextSourceLabel(source);
- //}
-
+ /**
+ * Return the number of justification records this uses.
+ */
public int getNumJustificationInfos() {
return getGV().getNumGlyphs();
}
-
+ /**
+ * Return GlyphJustificationInfo objects for the characters between
+ * charStart and charLimit, starting at offset infoStart. Infos
+ * will be in visual order. All positions between infoStart and
+ * getNumJustificationInfos will be set. If a position corresponds
+ * to a character outside the provided range, it is set to null.
+ */
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) {
// This simple implementation only uses spaces for justification.
// Since regular characters aren't justified, we don't need to deal with
}
}
+ /**
+ * Apply deltas to the data in this component, starting at offset
+ * deltaStart, and return the new component. There are two floats
+ * for each justification info, for a total of 2 * getNumJustificationInfos.
+ * The first delta is the left adjustment, the second is the right
+ * adjustment.
+ * <p>
+ * If flags[0] is true on entry, rejustification is allowed. If
+ * the new component requires rejustification (ligatures were
+ * formed or split), flags[0] will be set on exit.
+ */
public TextLineComponent applyJustificationDeltas(float[] deltas, int deltaStart, boolean[] flags) {
// when we justify, we need to adjust the charinfo since spaces
+++ /dev/null
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- * (C) Copyright IBM Corp. 1998-2003 All Rights Reserved
- */
-
-package sun.font;
-
-import java.awt.Graphics2D;
-import java.awt.Shape;
-
-import java.awt.geom.Rectangle2D;
-
-/**
- * A label.
- * Visual bounds is a rect that encompasses the entire rendered area.
- * Logical bounds is a rect that defines how to position this next
- * to other objects.
- * Align bounds is a rect that defines how to align this to margins.
- * it generally allows some overhang that logical bounds would prevent.
- */
-public abstract class TextLabel {
-
- /**
- * Return a rectangle that surrounds the text outline when this label is rendered at x, y.
- */
- public abstract Rectangle2D getVisualBounds(float x, float y);
-
- /**
- * Return a rectangle that corresponds to the logical bounds of the text
- * when this label is rendered at x, y.
- * This rectangle is used when positioning text next to other text.
- */
- public abstract Rectangle2D getLogicalBounds(float x, float y);
-
- /**
- * Return a rectangle that corresponds to the alignment bounds of the text
- * when this label is rendered at x, y. This rectangle is used when positioning text next
- * to a margin. It differs from the logical bounds in that it does not include leading or
- * trailing whitespace.
- */
- public abstract Rectangle2D getAlignBounds(float x, float y);
-
- /**
- * Return a rectangle that corresponds to the logical bounds of the text, adjusted
- * to angle the leading and trailing edges by the italic angle.
- */
- public abstract Rectangle2D getItalicBounds(float x, float y);
-
- /**
- * Return an outline of the characters in the label when rendered at x, y.
- */
- public abstract Shape getOutline(float x, float y);
-
- /**
- * Render the label at x, y in the graphics.
- */
- public abstract void draw(Graphics2D g, float x, float y);
-
- /**
- * A convenience method that returns the visual bounds when rendered at 0, 0.
- */
- public Rectangle2D getVisualBounds() {
- return getVisualBounds(0f, 0f);
- }
-
- /**
- * A convenience method that returns the logical bounds when rendered at 0, 0.
- */
- public Rectangle2D getLogicalBounds() {
- return getLogicalBounds(0f, 0f);
- }
-
- /**
- * A convenience method that returns the align bounds when rendered at 0, 0.
- */
- public Rectangle2D getAlignBounds() {
- return getAlignBounds(0f, 0f);
- }
-
- /**
- * A convenience method that returns the italic bounds when rendered at 0, 0.
- */
- public Rectangle2D getItalicBounds() {
- return getItalicBounds(0f, 0f);
- }
-
- /**
- * A convenience method that returns the outline when rendered at 0, 0.
- */
- public Shape getOutline() {
- return getOutline(0f, 0f);
- }
-
- /**
- * A convenience method that renders the label at 0, 0.
- */
- public void draw(Graphics2D g) {
- draw(g, 0f, 0f);
- }
-}
* @see Font
* @see FontRenderContext
* @see java.awt.font.GlyphVector
- * @see TextLabel
- * @see ExtendedTextLabel
+ * @see ExtendedTextSourceLabel
* @see Bidi
* @see java.awt.font.TextLayout
*/
}
/**
- * Create an extended glyph array for the text between start and limit.
+ * Create a glyph array for the text between start and limit.
*
* @param font the font to use to generate glyphs and character positions.
* @param start the start of the subrange for which to create the glyph array
* at start. Clients should ensure that all text between start and limit
* has the same bidi level for the current line.
*/
- public ExtendedTextLabel createExtended(Font font,
- CoreMetrics lm,
- Decoration decorator,
- int start,
- int limit) {
+ public ExtendedTextSourceLabel createTextLabel(Font font,
+ CoreMetrics lm,
+ Decoration decorator,
+ int start,
+ int limit) {
if (start >= limit || start < lineStart || limit > lineLimit) {
throw new IllegalArgumentException("bad start: " + start + " or limit: " + limit);
return new ExtendedTextSourceLabel(source, decorator);
}
- /**
- * Create a simple glyph array for the text between start and limit.
- *
- * @param font the font to use to generate glyphs and character positions.
- * @param start the start of the subrange for which to create the glyph array
- * @param limit the limit of the subrange for which to create glyph array
- */
- public TextLabel createSimple(Font font,
- CoreMetrics lm,
- int start,
- int limit) {
-
- if (start >= limit || start < lineStart || limit > lineLimit) {
- throw new IllegalArgumentException("bad start: " + start + " or limit: " + limit);
- }
-
- int level = lineBidi == null ? 0 : lineBidi.getLevelAt(start - lineStart);
- int linedir = (lineBidi == null || lineBidi.baseIsLeftToRight()) ? 0 : 1;
- int layoutFlags = flags & ~0x9; // remove bidi, line direction flags
- if ((level & 0x1) != 0) layoutFlags |= 1; // rtl
- if ((linedir & 0x1) != 0) layoutFlags |= 8; // line rtl
- TextSource source = new StandardTextSource(text, start, limit - start, lineStart, lineLimit - lineStart, level, layoutFlags, font, frc, lm);
- return new TextSourceLabel(source);
- }
}
+++ /dev/null
-/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- * (C) Copyright IBM Corp. 1998, 1999 - All Rights Reserved
- */
-
-package sun.font;
-
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-
-/**
- * Implementation of TextLabel based on String.
- */
-
-public class TextSourceLabel extends TextLabel {
- TextSource source;
-
- // caches
- Rectangle2D lb;
- Rectangle2D ab;
- Rectangle2D vb;
- Rectangle2D ib;
- GlyphVector gv;
-
- public TextSourceLabel(TextSource source) {
- this(source, null, null, null);
- }
-
- public TextSourceLabel(TextSource source, Rectangle2D lb, Rectangle2D ab, GlyphVector gv) {
- this.source = source;
-
- this.lb = lb;
- this.ab = ab;
- this.gv = gv;
- }
-
- public TextSource getSource() {
- return source;
- }
-
- public final Rectangle2D getLogicalBounds(float x, float y) {
- if (lb == null) {
- lb = createLogicalBounds();
- }
- return new Rectangle2D.Float((float)(lb.getX() + x),
- (float)(lb.getY() + y),
- (float)lb.getWidth(),
- (float)lb.getHeight());
- }
-
- public final Rectangle2D getVisualBounds(float x, float y) {
- if (vb == null) {
- vb = createVisualBounds();
-
- }
- return new Rectangle2D.Float((float)(vb.getX() + x),
- (float)(vb.getY() + y),
- (float)vb.getWidth(),
- (float)vb.getHeight());
- }
-
- public final Rectangle2D getAlignBounds(float x, float y) {
- if (ab == null) {
- ab = createAlignBounds();
- }
- return new Rectangle2D.Float((float)(ab.getX() + x),
- (float)(ab.getY() + y),
- (float)ab.getWidth(),
- (float)ab.getHeight());
- }
-
- public Rectangle2D getItalicBounds(float x, float y) {
- if (ib == null) {
- ib = createItalicBounds();
- }
- return new Rectangle2D.Float((float)(ib.getX() + x),
- (float)(ib.getY() + y),
- (float)ib.getWidth(),
- (float)ib.getHeight());
-
- }
-
- public Rectangle getPixelBounds(FontRenderContext frc, float x, float y) {
- return getGV().getPixelBounds(frc, x, y); // no cache
- }
-
- public AffineTransform getBaselineTransform() {
- Font font = source.getFont();
- if (font.hasLayoutAttributes()) {
- return AttributeValues.getBaselineTransform(font.getAttributes());
- }
- return null;
- }
-
- public Shape getOutline(float x, float y) {
- return getGV().getOutline(x, y);
- }
-
- public void draw(Graphics2D g, float x, float y) {
- g.drawGlyphVector(getGV(), x, y);
- }
-
- protected Rectangle2D createLogicalBounds() {
- return getGV().getLogicalBounds();
- }
-
- protected Rectangle2D createVisualBounds() {
- return getGV().getVisualBounds();
- }
-
- protected Rectangle2D createItalicBounds() {
- // !!! fix
- return getGV().getLogicalBounds();
- }
-
- protected Rectangle2D createAlignBounds() {
- return createLogicalBounds();
- }
-
- private GlyphVector getGV() {
- if (gv == null) {
- gv = createGV();
- }
-
- return gv;
- }
-
- protected GlyphVector createGV() {
- Font font = source.getFont();
- FontRenderContext frc = source.getFRC();
- int flags = source.getLayoutFlags();
- char[] context = source.getChars();
- int start = source.getStart();
- int length = source.getLength();
-
- GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines
- StandardGlyphVector gv = gl.layout(font, frc, context, start, length,
- flags, null); // ??? use textsource
- GlyphLayout.done(gl);
-
- return gv;
- }
-}